//
//  CollectionTableViewCell.m
//  afn
//
//  Created by mac on 2018/5/10.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "CollectionTableViewCell.h"

@implementation CollectionTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];


    // Configure the view for the selected state
}



-(void)creatView{
    self.backgroundColor=_LightGrey;
}
-(void)creatView2{
    UIImageView *imageView=[UIImageView new];
    [self.contentView addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(80);
        make.width.mas_equalTo(100);
    }];
    NSString *url=_model.shop_image;
    [imageView sd_setImageWithURL:[NSURL URLWithString:url]];
    if (imageView.image==nil) {
        imageView.image=[UIImage imageNamed:@"组89"];
    }
    
    UILabel *nameLabel=[UILabel new];
    [self.contentView  addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imageView.mas_right).mas_equalTo(10);
        make.top.mas_equalTo(imageView.mas_top).mas_equalTo(5);
        make.right.mas_equalTo(-90);
    }];
    nameLabel.text=_model.shop_name;
    nameLabel.font=[UIFont systemFontOfSize:16];
    nameLabel.textColor=ColorWithRGB(29, 29, 29);
    
    UILabel *jjuliLabel=[UILabel new];
    [self.contentView  addSubview:jjuliLabel];
    [jjuliLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.bottom.mas_equalTo(nameLabel);
    }];
    jjuliLabel.textColor=ColorWithRGB(149, 149, 149);
    jjuliLabel.font=[UIFont systemFontOfSize:13];
    jjuliLabel.text=@"0.36km";
    

 
    if (_model.shop_service_score.doubleValue==0||_model.shop_service_score==nil) {
        UILabel *pingFenLabel=[UILabel new];
        [self.contentView  addSubview:pingFenLabel];
        [pingFenLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(nameLabel);
            make.centerY.mas_equalTo(imageView);
        }];
        pingFenLabel.text=@"暂无评分";
        pingFenLabel.textColor=ColorWithRGB(149, 149, 149);
        pingFenLabel.font=[UIFont systemFontOfSize:12];
    }
    else{
        for (int i=0; i<_model.shop_service_score.integerValue; i++) {
            UIImageView *fenImge=[UIImageView new];
            [self.contentView  addSubview:fenImge];
            [fenImge mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(nameLabel.mas_left).mas_equalTo(20*i);
                make.height.mas_equalTo(12);
                make.width.mas_equalTo(15);
                make.centerY.mas_equalTo(imageView);
            }];
            fenImge.image=[UIImage imageNamed:@"ico-zuanshi"];
        }
        
        UILabel *pingFenLabel=[UILabel new];
        [self.contentView  addSubview:pingFenLabel];
        [pingFenLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(nameLabel.mas_left).mas_equalTo(20*self->_model.shop_service_score.intValue);
            make.centerY.mas_equalTo(imageView);
        }];
        pingFenLabel.text=[NSString stringWithFormat:@"%2.f分",_model.shop_service_score.floatValue];
        pingFenLabel.font=[UIFont systemFontOfSize:13];
        pingFenLabel.textColor=ColorWithRGB(149, 149, 149);
    }
    
    
    UILabel *priceLabel=[UILabel new];
    [self.contentView  addSubview:priceLabel];
    [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nameLabel);
        make.bottom.mas_equalTo(imageView).mas_equalTo(-3);
    }];
    priceLabel.textColor=_backgroundColor;
    priceLabel.font=[UIFont systemFontOfSize:13];
    priceLabel.text=_model.category_name;
    [priceLabel layoutIfNeeded];
 
    UIImageView *tuiJian=[UIImageView new];
    [self.contentView  addSubview:tuiJian];
    [tuiJian mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(priceLabel.mas_right).mas_equalTo(5);
        make.centerY.mas_equalTo(priceLabel);
        make.width.mas_equalTo(30);
        make.height.mas_equalTo(10);
    }];
    tuiJian.image=[UIImage imageNamed:@"ico-tuijian"];
    
    UIView *xianView=[UIView new];
    [self.contentView  addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(10);
        make.height.mas_equalTo(1);
        make.bottom.mas_equalTo(0);
    }];
    xianView.backgroundColor=_LightGrey;
}
-(void)creatView3{
    
    UIImageView *imageView=[UIImageView new];
    [self.contentView  addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(80);
        make.width.mas_equalTo(100);
    }];
    NSString *url=_model.shop_image;
    [imageView sd_setImageWithURL:[NSURL URLWithString:url]];
    if (imageView.image==nil) {
        imageView.image=[UIImage imageNamed:@"组89"];
    }
    
    UILabel *nameLabel=[UILabel new];
    [self.contentView  addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imageView.mas_right).mas_equalTo(10);
        make.top.mas_equalTo(imageView.mas_top).mas_equalTo(5);
        make.right.mas_equalTo(-90);
    }];
    nameLabel.text=_model.shop_name;
    nameLabel.font=[UIFont systemFontOfSize:16];
    nameLabel.textColor=ColorWithRGB(29, 29, 29);
    
    UILabel *jjuliLabel=[UILabel new];
    [self.contentView  addSubview:jjuliLabel];
    [jjuliLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.bottom.mas_equalTo(nameLabel);
    }];
    jjuliLabel.textColor=ColorWithRGB(149, 149, 149);
    jjuliLabel.font=[UIFont systemFontOfSize:13];
    jjuliLabel.text=@"0.36km";
    
    
    
    UILabel *leiXingLabel=[UILabel new];
    [self.contentView  addSubview:leiXingLabel];
    [leiXingLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nameLabel);
        make.centerY.mas_equalTo(imageView);
    }];
    leiXingLabel.textColor=[UIColor orangeColor];
    leiXingLabel.text=[NSString stringWithFormat:@"[%@]",_model.category_name];
    leiXingLabel.font=[UIFont systemFontOfSize:13];
    [leiXingLabel layoutIfNeeded];
    
    UILabel *shuoMingLabel=[UILabel new];
    [self.contentView  addSubview:shuoMingLabel];
    [shuoMingLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(leiXingLabel.mas_right).mas_equalTo(2);
        make.centerY.mas_equalTo(leiXingLabel);
        make.right.mas_equalTo(-10);
    }];
    shuoMingLabel.textColor=ColorWithRGB(149, 149, 149);
    shuoMingLabel.font=[UIFont systemFontOfSize:13];
    shuoMingLabel.text=_model.hairdresser_name;
    
    UILabel *priceLabel=[UILabel new];
    [self.contentView  addSubview:priceLabel];
    [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nameLabel);
        make.bottom.mas_equalTo(imageView).mas_equalTo(-3);
    }];
    priceLabel.textColor=_backgroundColor;
    priceLabel.font=[UIFont systemFontOfSize:15];
    priceLabel.text=[NSString stringWithFormat:@"¥%@",_model.favorable_Price];
    [priceLabel layoutIfNeeded];
    
    UILabel *priceLabel2=[UILabel new];
    [self.contentView  addSubview:priceLabel2];
    [priceLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(priceLabel.mas_right);
        make.centerY.mas_equalTo(priceLabel);
    }];
    priceLabel2.text=[NSString stringWithFormat:@"门店价：¥%@",_model.sale_price];
    priceLabel2.font=[UIFont systemFontOfSize:14];
    priceLabel2.textColor=ColorWithRGB(99, 99, 99);
    
    UIView *xianView=[UIView new];
    [self.contentView  addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(10);
        make.height.mas_equalTo(1);
        make.bottom.mas_equalTo(0);
    }];
    xianView.backgroundColor=_LightGrey;
    
}
@end
